/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.cotec.model;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author magalhaes
 */
@Entity
@Table(name = "contato")
@NamedQueries({@NamedQuery(name = "Contato.findAll", query = "SELECT c FROM Contato c"), @NamedQuery(name = "Contato.findById", query = "SELECT c FROM Contato c WHERE c.id = :id"), @NamedQuery(name = "Contato.findByNumeroEmpresa", query = "SELECT c FROM Contato c WHERE c.numeroEmpresa = :numeroEmpresa"), @NamedQuery(name = "Contato.findByNumeroCelular", query = "SELECT c FROM Contato c WHERE c.numeroCelular = :numeroCelular"), @NamedQuery(name = "Contato.findByRamal", query = "SELECT c FROM Contato c WHERE c.ramal = :ramal")})
public class Contato implements Serializable {
    private static final long serialVersionUID = 1L;
	
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "nm_empresa", length=13)
    private String numeroEmpresa;
    @Basic(optional = true)
    @Column(name = "nm_celular", length=13)
    private String numeroCelular;
    @Basic(optional = true)
    @Column(name = "ramal", length=4)
    private String ramal;
    @JoinColumn(name = "pessoa", referencedColumnName = "id")
    @OneToOne(optional = false)
    private Pessoa pessoa;
    
    public Contato() {
    }

    public Contato(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRamal() {
        return ramal;
    }

    public String getNumeroEmpresa() {
		return numeroEmpresa;
	}

	public void setNumeroEmpresa(String numeroEmpresa) {
		this.numeroEmpresa = numeroEmpresa;
	}

	public String getNumeroCelular() {
		return numeroCelular;
	}

	public void setNumeroCelular(String numeroCelular) {
		this.numeroCelular = numeroCelular;
	}

	public void setRamal(String ramal) {
        this.ramal = ramal;
    }

    public Pessoa getPessoa() {
        return pessoa;
    }

    public void setPessoa(Pessoa pessoa) {
        this.pessoa = pessoa;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contato)) {
            return false;
        }
        Contato other = (Contato) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.cotec.model.Contato[id=" + id + "]";
    }

}
